<%@ page import="cn.tedu.web.sww.JdbcUtils" %>
<%@ page import="cn.tedu.web.sww.pojo.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String id = request.getParameter("id");
    User user = null;
    if (id != null){
        String sql = "SELECT `name`, username FROM `user` WHERE id = ?";

        user = JdbcUtils.select(sql, User.class, id);
    }else {
        user = new User();
        user.setName("");
        user.setUsername("");
    }


%>


<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java实训团队协作简单案例 - 用户信息编辑页面</title>
    <link rel="shortcut icon" href="assets/img/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="assets/vendors/font-awesome-4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/css/core.css" />
    <link rel="stylesheet" href="assets/css/index.css" />

    <link rel="stylesheet" href="assets/css/user.css" />
</head>

<body>
<jsp:include page="/WEB-INF/tpl/sww/header.jsp"/>
    <section class="container">
        <jsp:include page="/WEB-INF/tpl/sww/left.jsp"/>
        <div class="main-right">
            <h3>用户信息编辑页面</h3>
            <form action="/user/addsww">
                姓名：<input name="n" type="text" value="<%=user.getName()%>" />
                账号：<input name="u" type="text" value="<%=user.getUsername()%>" />
                <button>保存</button>
                <input type="hidden" name="i" value="<%=id%>"/>
            </form>
        </div>
    </section>
</body>

</html>